home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 April / EnigmA AMIGA RUN 17 (1997)(G.R. Edizioni)(IT)[!][issue 1997-04][EAR-CD].iso / EARCD / comm / term / term_47a_pch.lha / Source / gtlayout-38.3 / gtlayout_internal.h next >
C/C++ Source or Header  |  1996-11-12  |  22KB  |  1,008 lines

  1. /*
  2. **    GadTools layout toolkit
  3. **
  4. **    Copyright © 1993-1996 by Olaf `Olsen' Barthel
  5. **        Freely distributable.
  6. */
  7.  
  8. #ifndef _GTLAYOUT_INTERNAL_H
  9. #define _GTLAYOUT_INTERNAL_H 1
  10.  
  11.     // Debugging stuff
  12.  
  13. #ifdef DEBUG
  14. #define DB(x)    x
  15. #else
  16. #define DB(x)    ;
  17. #endif    /* DEBUG */
  18.  
  19.     // Keep this one handy
  20.  
  21. VOID kprintf(STRPTR,...);
  22.  
  23. /*****************************************************************************/
  24.  
  25.  
  26.     // Keyboard qualifiers
  27.  
  28. #define QUALIFIER_SHIFT     (IEQUALIFIER_LSHIFT | IEQUALIFIER_RSHIFT)
  29. #define QUALIFIER_ALT        (IEQUALIFIER_LALT | IEQUALIFIER_RALT)
  30. #define QUALIFIER_CONTROL    (IEQUALIFIER_CONTROL)
  31.  
  32.  
  33. /*****************************************************************************/
  34.  
  35.  
  36.     // Undefine these to remove various chunks of support from this code
  37.  
  38. #ifdef _GTLAYOUT_GLOBAL_H
  39. #define DO_PASSWORD_KIND
  40. #define DO_GAUGE_KIND
  41. #define DO_TAPEDECK_KIND
  42. #define DO_HEXHOOK
  43. #define DO_PICKSHORTCUTS
  44. #define DO_CLONING
  45. #define DO_LEVEL_KIND
  46. #define DO_BOOPSI_KIND
  47. #define DO_MENUS
  48. #define DO_POPUP_KIND
  49. #define DO_TAB_KIND
  50. #else
  51. #define DO_PASSWORD_KIND
  52. #define DO_GAUGE_KIND
  53. #define DO_CLONING
  54. #define DO_BOOPSI_KIND
  55. #define DO_POPUP_KIND
  56. #endif    // _GTLAYOUT_GLOBAL_H
  57.  
  58.  
  59. /*****************************************************************************/
  60.  
  61.  
  62. APTR ASM AsmCreatePool(REG(d0) ULONG MemFlags,REG(d1) ULONG PuddleSize,REG(d2) ULONG ThreshSize,REG(a6) struct ExecBase *SysBase);
  63. VOID ASM AsmDeletePool(REG(a0) APTR PoolHeader,REG(a6) struct ExecBase *SysBase);
  64. APTR ASM AsmAllocPooled(REG(a0) APTR PoolHeader,REG(d0) ULONG Size,REG(a6) struct ExecBase *SysBase);
  65. VOID ASM AsmFreePooled(REG(a0) APTR PoolHeader,REG(a1) APTR Memory,REG(d0) ULONG MemSize,REG(a6) struct ExecBase *SysBase);
  66.  
  67.  
  68. /*****************************************************************************/
  69.  
  70.  
  71.     // Scan an Exec list
  72.  
  73. #define SCANLIST(l,n)    for(n = (APTR)((struct MinList *)l) -> mlh_Head; \
  74.             ((struct MinNode *)n) -> mln_Succ; \
  75.             n = (APTR)((struct MinNode *)n) -> mln_Succ)
  76.  
  77.     // Scan the objects of a group
  78.  
  79. #define SCANGROUP(g,n)    for(n = (APTR)g -> Special . Group . ObjectList . mlh_Head; \
  80.             ((struct MinNode *)n) -> mln_Succ; \
  81.             n = (APTR)((struct MinNode *)n) -> mln_Succ)
  82.  
  83.     // Scan the objects of a group, only allowing active pages
  84.  
  85. #define SCANPAGE(g,n,p) for(p = 0, n = (APTR)g -> Special . Group . ObjectList . mlh_Head; \
  86.             ((struct MinNode *)n) -> mln_Succ; \
  87.             n = (APTR)((struct MinNode *)n) -> mln_Succ) \
  88.             if ((p++ == g -> Special . Group . ActivePage) || !g -> Special . Group . Paging)
  89.  
  90.     // Get an object pointer from a gadget pointer
  91.  
  92. #define GETOBJECT(g,n)    ((n = (ObjectNode *)g -> UserData) && (n -> Host == g) && (n -> PointBack == n))
  93.  
  94.  
  95. /*****************************************************************************/
  96.  
  97.  
  98. #ifdef DO_PASSWORD_KIND
  99. #define TEST_PASSWORD_KIND(n) || (n -> Type == PASSWORD_KIND)
  100. #else
  101. #define TEST_PASSWORD_KIND(n) || (FALSE)
  102. #endif
  103.  
  104.     // Is an object derived from STRING_KIND?
  105.  
  106. #define LIKE_STRING_KIND(n)    ((n -> Type == STRING_KIND || n -> Type == FRACTION_KIND) TEST_PASSWORD_KIND(n))
  107.  
  108.  
  109. /*****************************************************************************/
  110.  
  111.  
  112. #define NUMELEMENTS(s)        (sizeof(s) / sizeof((s)[0]))
  113.  
  114.  
  115. /*****************************************************************************/
  116.  
  117.  
  118. typedef char BOOLEAN;
  119.  
  120. #define INCREMENTER_KIND    42
  121. #define PICKER_KIND        43
  122. #define GROUP_KIND        44
  123.  
  124. #define LAPR_Gadget        TAG_USER+100
  125. #define LAPR_Object        TAG_USER+101
  126.  
  127. typedef struct GaugeExtra
  128. {
  129.     LONG             InfoLength;
  130.     STRPTR             InfoText;
  131.     WORD             LastPercentage;
  132.     BOOLEAN             NoTicks;
  133.     BOOLEAN             Discrete;
  134. } GaugeExtra;
  135.  
  136. typedef struct TapeDeckExtra
  137. {
  138.     struct Image        *ButtonImage;
  139.     LONG             ButtonWidth,
  140.                  ButtonHeight;
  141.     BOOLEAN          ButtonType;
  142.     BOOLEAN             Toggle;
  143.     BOOLEAN             Smaller;
  144.     BOOLEAN             Tick;
  145. } TapeDeckExtra;
  146.  
  147. typedef struct ButtonExtra
  148. {
  149.     struct Image        *ButtonImage;
  150.     STRPTR             KeyStroke;
  151.     STRPTR            *Lines;
  152.     UBYTE             LineCount;
  153.  
  154.     BOOLEAN          ReturnKey;
  155.     BOOLEAN          EscKey;
  156.     BOOLEAN          ExtraFat;
  157.     BOOLEAN             DefaultCorrection;
  158.     BOOLEAN             Smaller;
  159. } ButtonExtra;
  160.  
  161. typedef struct BarExtra
  162. {
  163.     struct ObjectNode    *Parent;
  164.     BOOLEAN          FullSize;
  165. } BarExtra;
  166.  
  167. typedef struct BoxExtra
  168. {
  169.     struct ObjectNode    *Parent;
  170.     STRPTR            *Labels;
  171.     STRPTR            *Lines;
  172.     WORD             MaxSize;
  173.     BYTE             AlignText;
  174.     BOOLEAN          DrawBox;
  175.     BOOLEAN          ReserveSpace;
  176. } BoxExtra;
  177.  
  178. typedef struct FrameExtra
  179. {
  180.     struct Hook        *RefreshHook;
  181.     UWORD             InnerWidth;
  182.     UWORD             InnerHeight;
  183.     struct Gadget         Dummy;
  184.     BOOLEAN          DrawBox;
  185.     BOOLEAN             GenerateEvents;
  186. } FrameExtra;
  187.  
  188. typedef struct PickerExtra
  189. {
  190.     struct Gadget        *Parent;    // Important: must match IncrementerExtra!
  191.     struct Image        *Image;        // Important: must match IncrementerExtra!
  192. } PickerExtra;
  193.  
  194. typedef struct IncrementerExtra
  195. {
  196.     struct Gadget        *Parent;    // Important: must match PickerExtra!
  197.     struct Image        *Image;        // Important: must match PickerExtra!
  198.     LONG             Amount;
  199. } IncrementerExtra;
  200.  
  201. typedef struct GroupExtra
  202. {
  203.     struct MinList         ObjectList;
  204.     struct ObjectNode    *ParentGroup;
  205.     LONG             MaxOffset;
  206.     LONG             MaxSize;
  207.     ULONG             ActivePage;
  208. #ifdef NOT_FUNCTIONAL
  209.     LONG             UseWidth;
  210.     LONG             UseHeight;
  211. #endif    // NOT_FUNCTIONAL
  212.     UWORD             ExtraLeft;
  213.     UWORD             ExtraTop;
  214.     UWORD             FrameType;
  215.     UBYTE             MiscFlags;
  216.     BOOLEAN          Horizontal;
  217.     BOOLEAN          Paging;
  218.     BOOLEAN          Spread;
  219.     BOOLEAN          SameSize;
  220.     BOOLEAN          LastAttributes;
  221.     BOOLEAN          Visible;
  222.     BOOLEAN             Frame;
  223.     BOOLEAN             IndentX;
  224.     BOOLEAN             IndentY;
  225.     BOOLEAN             NoIndent;
  226. } GroupExtra;
  227.  
  228. #define GROUPF_WidthDone    (1<<0)
  229. #define GROUPF_HeightDone    (1<<1)
  230.  
  231. typedef struct ListExtra
  232. {
  233.     struct List        *Labels;
  234.     struct Gadget        *Link;
  235.     LONG             LinkID;
  236.     struct Hook        *CallBack;
  237.     LONG             AutoPageID;
  238.     struct TextAttr        *TextAttr;
  239.     STRPTR            *ExtraLabels;
  240.     UWORD             ExtraLabelWidth;
  241.     UWORD             MaxPen;
  242.     UWORD             MaxGrowX,MaxGrowY;
  243.     UWORD             MinChars,MinLines;
  244.     WORD             FixedGlyphWidth;
  245.     WORD             FixedGlyphHeight;
  246.     BOOLEAN          ReadOnly;
  247.     BOOLEAN          CursorKey;
  248.     BOOLEAN          AllocatedList;
  249.     BOOLEAN             LockSize;
  250.     BOOLEAN             SizeLocked;
  251.     BOOLEAN             ResizeX;
  252.     BOOLEAN             ResizeY;
  253.     BOOLEAN             FlushLabelLeft;
  254.     BOOLEAN             IgnoreListContents;
  255. } ListExtra;
  256.  
  257. typedef struct RadioExtra
  258. {
  259.     STRPTR            *Choices;
  260.     LONG             AutoPageID;
  261.     UWORD             LabelWidth;
  262.     UBYTE             TitlePlace;
  263.     BOOLEAN             TabKey;
  264. } RadioExtra;
  265.  
  266. typedef struct TextExtra
  267. {
  268.     STRPTR             Text;
  269.     struct Gadget        *Picker;
  270.     WORD             FrontPen;
  271.     WORD             BackPen;
  272.     UWORD             Len;
  273.     UBYTE             Justification;
  274.     BOOLEAN          Border;
  275.     BOOLEAN          CopyText;
  276.     BOOLEAN          UsePicker;
  277.     BOOLEAN             LockSize;
  278.     BOOLEAN             SizeLocked;
  279. } TextExtra;
  280.  
  281. typedef struct NumberExtra
  282. {
  283.     LONG             Number;
  284.     STRPTR             Format;
  285.     WORD             FrontPen;
  286.     WORD             BackPen;
  287.     WORD             MaxNumberLen;
  288.     UBYTE             Justification;
  289.     BOOLEAN          Border;
  290. } NumberExtra;
  291.  
  292. typedef struct CycleExtra
  293. {
  294.     STRPTR            *Choices;
  295.     LONG             AutoPageID;
  296.     BOOLEAN             TabKey;
  297. } CycleExtra;
  298.  
  299. typedef struct PalExtra
  300. {
  301.     UBYTE            *ColourTable;
  302.     UBYTE            *TranslateBack;
  303.     struct Gadget        *Picker;
  304.     UWORD             Depth;
  305.     UWORD             NumColours;
  306.     UWORD             IndicatorWidth;
  307.     BOOLEAN          SmallPalette;
  308.     BOOLEAN             UsePicker;
  309. } PalExtra;
  310.  
  311. typedef struct SliderExtra
  312. {
  313.     STRPTR             LevelFormat;
  314.     DISPFUNC         DispFunc;
  315.     LONG             MaxLevelLen;
  316.     LONG             LevelWidth;
  317.     STRPTR             OriginalLabel;
  318.     UBYTE             LevelPlace;
  319.     BOOLEAN          FullLevelCheck;
  320. } SliderExtra;
  321.  
  322. typedef struct StringExtra
  323. {
  324.     struct LayoutHandle    *LayoutHandle;
  325.     struct Hook        *HistoryHook;
  326.     ULONG             MaxHistoryLines;
  327.     ULONG             NumHistoryLines;
  328.     struct Node        *CurrentNode;
  329.  
  330.     STRPTR             String;
  331.     LONG             MaxChars;
  332.     struct Hook        *EditHook;
  333.     struct Hook        *ValidateHook;
  334.     struct Gadget        *Picker;
  335.     STRPTR             Backup;
  336.     STRPTR             RealString;
  337.     STRPTR             Original;
  338.     LONG             LinkID;
  339.  
  340.     UBYTE             Justification;
  341.     BOOLEAN          LastGadget;
  342.     BOOLEAN          UsePicker;
  343.     BOOLEAN             Activate;
  344. } StringExtra;
  345.  
  346. typedef struct IntegerExtra
  347. {
  348.     struct LayoutHandle    *LayoutHandle;
  349.     struct Hook        *HistoryHook;
  350.     ULONG             MaxHistoryLines;
  351.     ULONG             NumHistoryLines;
  352.     struct Node        *CurrentNode;
  353.  
  354.     struct Gadget        *LeftIncrementer;
  355.     struct Gadget        *RightIncrementer;
  356.  
  357.     struct Hook        *IncrementerHook;
  358.  
  359.     LONG             Number;
  360.     LONG             MaxChars;
  361.     struct Hook        *EditHook;
  362.     struct Hook        *ValidateHook;
  363.  
  364.     UBYTE             Justification;
  365.     BOOLEAN          LastGadget;
  366.     BOOLEAN          UseIncrementers;
  367.     BOOLEAN             CustomHook;
  368.     BOOLEAN             Activate;
  369. } IntegerExtra;
  370.  
  371. typedef struct ScrollerExtra
  372. {
  373.     WORD             Visible;
  374.     WORD             ArrowSize;
  375.     BOOLEAN          RelVerify;
  376.     BOOLEAN             Immediate;
  377.     BOOLEAN             Arrows;
  378.     BOOLEAN             Vertical;
  379.     BOOLEAN             Thin;
  380. } ScrollerExtra;
  381.  
  382. typedef struct LevelExtra
  383. {
  384.     struct LayoutHandle    *Handle;
  385.     LONG             Plus;
  386.     STRPTR             LevelFormat;
  387.     struct Image        *LevelImage;
  388.     DISPFUNC         DispFunc;
  389.     LONG             MaxLevelWidth,
  390.                  MidOffset,
  391.                  LevelPlace;
  392.     struct Hook         CustomHook;
  393.     UBYTE             FormatBuffer[80];
  394.     BOOLEAN             FullLevelCheck;
  395. } LevelExtra;
  396.  
  397. typedef struct BOOPSIExtra
  398. {
  399.     struct Library        *ClassBase;
  400.     Class            *ClassInstance;
  401.     STRPTR             ClassName;
  402.     STRPTR             ClassLibraryName;
  403.     struct TagItem        *ClassTags;
  404.     ULONG             TagCurrent,
  405.                  TagTextAttr,
  406.                  TagDrawInfo,
  407.                  TagLink,
  408.                  TagScreen;
  409.     LONG             Link;
  410.     struct ObjectNode    *Parent;
  411.     struct Hook        *ActivateHook;
  412.     WORD             ExactWidth,
  413.                  ExactHeight;
  414.     WORD             RelFontHeight;
  415.     BOOLEAN             FullWidth;
  416.     BOOLEAN             FullHeight;
  417. } BOOPSIExtra;
  418.  
  419. typedef struct PopupExtra
  420. {
  421.     STRPTR            *Choices;
  422.     LONG             AutoPageID;
  423.     BOOLEAN             TabKey;
  424.     BOOLEAN             CentreActive;
  425. } PopupExtra;
  426.  
  427. typedef struct TabExtra
  428. {
  429.     STRPTR            *Choices;
  430.     LONG             AutoPageID;
  431.     struct ObjectNode    *Parent;
  432.     BOOLEAN             TabKey;
  433.     BOOLEAN             FullWidth;
  434.     BOOLEAN             FrameGroup;
  435. } TabExtra;
  436.  
  437. typedef struct ObjectNode
  438. {
  439.     struct MinNode         Node;
  440.     struct Gadget        *Host;
  441.     struct ObjectNode    *PointBack;
  442.     STRPTR             Label;
  443.     LONG             ID;
  444.     LONG             Min;
  445.     LONG             Max;
  446.     LONG             Current;
  447.     APTR             Storage;
  448.  
  449.     UWORD             Left;
  450.     UWORD             Top;
  451.     UWORD             Width;
  452.     UWORD             Height;
  453.     UWORD             LabelWidth;
  454.     UWORD             Lines;
  455.     UWORD             Chars;
  456.     WORD             ExtraSpace;
  457.     WORD             LabelChars;
  458.  
  459.     UBYTE             Type;
  460.     BYTE             LabelPlace;
  461.     UBYTE             Key;
  462.     UBYTE             StorageType;
  463.     BYTE             Pad0;
  464.     BOOLEAN          Disabled;
  465.     BOOLEAN          NoKey;
  466.     BOOLEAN          HighLabel;
  467.     BOOLEAN          GroupIndent;
  468.     BOOLEAN          PageSelector;
  469.  
  470.     union
  471.     {
  472.         GaugeExtra        Gauge;
  473.         TapeDeckExtra        TapeDeck;
  474.         ButtonExtra        Button;
  475.         BarExtra        Bar;
  476.         BoxExtra        Box;
  477.         FrameExtra        Frame;
  478.         PickerExtra        Picker;
  479.         IncrementerExtra    Incrementer;
  480.         GroupExtra        Group;
  481.         ListExtra        List;
  482.         RadioExtra        Radio;
  483.         TextExtra        Text;
  484.         NumberExtra        Number;
  485.         CycleExtra        Cycle;
  486.         PalExtra        Palette;
  487.         SliderExtra        Slider;
  488.         StringExtra        String;
  489.         IntegerExtra        Integer;
  490.         ScrollerExtra        Scroller;
  491.         LevelExtra        Level;
  492.         BOOPSIExtra        BOOPSI;
  493.         PopupExtra        Popup;
  494.         TabExtra        Tab;
  495.     } Special;
  496. } ObjectNode;
  497.  
  498. typedef struct LayoutHandle
  499. {
  500.         // WARNING: Beginning of this structure must match the definition in gtlayout.h!
  501.  
  502.     struct Screen        *Screen;
  503.     struct DrawInfo     *DrawInfo;
  504.     struct Window        *Window;
  505.     APTR             VisualInfo;
  506.     struct Image        *AmigaGlyph;
  507.     struct Image        *CheckGlyph;
  508.     APTR             UserData;
  509.     struct Menu        *Menu;
  510.  
  511.         // End of public part
  512.  
  513.     struct Screen        *PubScreen;
  514.     struct MsgPort        *MsgPort;
  515.     struct Gadget        **GadgetArray;
  516.     struct Gadget        *Previous;
  517.     struct Gadget        *List;
  518.     ULONG             IDCMP;
  519.     ULONG             WA_ScreenTag;
  520.     BOOL             UnlockPubScreen;
  521.     BOOL             Pad1;
  522.  
  523.         // BOOPSI support
  524.  
  525.     Object            *BOOPSIPrevious;
  526.     Object            *BOOPSIList;
  527.  
  528.         // Incrementers
  529.  
  530.     ObjectNode        *ActiveIncrementer;
  531.     WORD             IncrementerCountdown;
  532.     WORD             IncrementerAccelerate;
  533.     LONG             IncrementerIncrement;
  534.  
  535.         // Frames
  536.  
  537.     ObjectNode        *ActiveFrame;
  538.  
  539.         // Cached from DrawInfo structure
  540.  
  541.     UWORD             TextPen;
  542.     UWORD             BackgroundPen;
  543.     UWORD             ShadowPen;
  544.     UWORD             ShinePen;
  545.  
  546.     UWORD             AspectX;
  547.     UWORD             AspectY;
  548.  
  549.         // Double-click support
  550.  
  551.     ULONG             ClickSeconds;
  552.     ULONG             ClickMicros;
  553.     ObjectNode        *ClickObject;
  554.  
  555.     struct Hook        *LocaleHook;
  556.     struct TextAttr     *TextAttr;
  557.     struct TextAttr     *InitialTextAttr;
  558.     struct TTextAttr     CopyTextAttr;
  559.     struct RastPort      RPort;
  560.  
  561.     APTR             Pool;
  562.  
  563.     UWORD             GlyphWidth;
  564.     UWORD             GlyphHeight;
  565.  
  566.     UWORD             InterWidth;
  567.     UWORD             InterHeight;
  568.  
  569.     LONG             Count;
  570.  
  571.     LONG             Index;
  572.  
  573.     ObjectNode        *TopGroup;
  574.     ObjectNode        *CurrentGroup;
  575.     ObjectNode        *EscKey;
  576.     ObjectNode        *ReturnKey;
  577.     ObjectNode        *CursorKey;
  578.     ObjectNode        *GrowView;
  579.     ObjectNode        *ResizeView;
  580.     ObjectNode        *TabKey;
  581.     ObjectNode        *ActiveString;
  582. #ifdef DO_PASSWORD_KIND
  583.     struct Hook         PasswordEditHook;
  584. #endif
  585. #ifdef DO_HEXHOOK
  586.     struct Hook         HexEditHook;
  587. #endif
  588.     struct Hook         DefaultEditHook;
  589.     struct Hook        *StandardEditHook;
  590.  
  591.     struct Hook         BackfillHook;
  592.     struct RastPort         BackfillRastPort;
  593.  
  594. #ifdef DO_LEVEL_KIND
  595.     ObjectNode        *CurrentLevel;
  596. #endif    /* DO_LEVEL_KIND */
  597.  
  598.     struct TTextAttr     FixedFont;
  599.  
  600.     struct LayoutHandle    *PointBack;
  601.  
  602.     LONG             GroupID;
  603.  
  604. #ifdef DO_PICKSHORTCUTS
  605.     UBYTE             Keys[256];
  606. #endif
  607.  
  608.     struct Window        *Parent;        // Parent of this window
  609.     struct Hook        *HelpHook;        // Hook to call when help key is pressed
  610.     LONG             MaxPen;
  611.  
  612.     WORD             SizeWidth;
  613.     WORD             SizeHeight;
  614.  
  615.     BOOLEAN             SizeVerified;
  616.     BOOLEAN          AutoRefresh;
  617.     BOOLEAN          CloseFont;
  618.     BOOLEAN          Failed;
  619.     BOOLEAN          Rescaled;
  620.     BOOLEAN          AutoActivate;
  621.     BOOLEAN          MoveToWindow;
  622.     BOOLEAN             NeedDelay;
  623.     BOOLEAN             RawKeyFilter;
  624.     BOOLEAN             FlushLeft;
  625.     BOOLEAN             FlushTop;
  626.     BOOLEAN             BlockParent;
  627.     BOOLEAN             ExitFlush;
  628.     BOOLEAN             NoKeys;
  629.  
  630. #ifdef DO_CLONING
  631.     struct CloneExtra    *CloneExtra;        // Screen cloning information
  632.     BOOLEAN          CloningPermitted;    // Genetic engineering?
  633.     BOOLEAN          ExactClone;        // Make an exact copy, i.e. preserve all colours
  634.     BOOLEAN             SimpleClone;        // Just a simple clone, please
  635.     BYTE             Pad0;
  636. #endif
  637. } LayoutHandle;
  638.  
  639. #define PHANTOM_GROUP_ID    -10000    // Phantom groups, i.e those without proper
  640.                     // IDs start with this ID
  641.  
  642. /*****************************************************************************/
  643.  
  644.  
  645.     // Window locking
  646.  
  647. typedef struct LockNode
  648. {
  649.     struct MinNode         MinNode;
  650.     struct Window        *Window;
  651.     LONG             Count;
  652.     ULONG             OldIDCMPFlags;
  653.     struct Requester     Requester;
  654.     LONG             MinWidth;
  655.     LONG             MinHeight;
  656.     LONG             MaxWidth;
  657.     LONG             MaxHeight;
  658. } LockNode;
  659.  
  660.  
  661. /*****************************************************************************/
  662.  
  663.  
  664.     // Image class extension
  665.  
  666. typedef struct ImageInfo
  667. {
  668.     STRPTR            *Lines;        // Text lines
  669.     STRPTR             KeyStroke;    // Points to char that acts as keystroke identifier
  670.  
  671.     STRPTR             Label;        // Single label if any
  672.  
  673.     struct TextFont        *Font;        // Open font if any
  674.  
  675.     UWORD             ImageType;    // Type
  676.  
  677.     UWORD             GlyphWidth;    // Size
  678.     UWORD             GlyphHeight;
  679.  
  680.     UWORD             LineCount;    // Number of lines below
  681.  
  682.     BOOLEAN             Emboss;    // Emboss the bevel box
  683. } ImageInfo;
  684.  
  685.     // Image class extension types
  686.  
  687. #define IIA_ImageType    (TAG_USER+739)
  688. #define IIA_GlyphWidth    (TAG_USER+740)
  689. #define IIA_GlyphHeight    (TAG_USER+741)
  690. #define IIA_Lines    (TAG_USER+742)
  691. #define IIA_LineCount    (TAG_USER+743)
  692. #define IIA_KeyStroke    (TAG_USER+744)
  693. #define IIA_Emboss    (TAG_USER+745)
  694. #define IIA_Label    (TAG_USER+746)
  695. #define IIA_Font    (TAG_USER+747)
  696.  
  697.     // Supported image class extension types
  698.  
  699. enum
  700. {
  701.     IMAGECLASS_PICKER,
  702.     IMAGECLASS_LEFTINCREMENTER,
  703.     IMAGECLASS_RIGHTINCREMENTER,
  704.     IMAGECLASS_BACKWARD,
  705.     IMAGECLASS_FORWARD,
  706.     IMAGECLASS_PREVIOUS,
  707.     IMAGECLASS_NEXT,
  708.     IMAGECLASS_RECORD,
  709.     IMAGECLASS_PLAY,
  710.     IMAGECLASS_STOP,
  711.     IMAGECLASS_PAUSE,
  712.     IMAGECLASS_REWIND,
  713.     IMAGECLASS_EJECT,
  714.     IMAGECLASS_MULTILINEBUTTON
  715. };
  716.  
  717.  
  718. /*****************************************************************************/
  719.  
  720.  
  721.     // Level image class
  722.  
  723. typedef struct LevelImageInfo
  724. {
  725.     LONG         Position;    // Position of knob on level body
  726.     LONG         Max;        // Maximum value
  727.     LONG         Current;    // Current value
  728.  
  729.     UWORD        *Pens;        // We don't really need the DrawInfo, just the pens
  730.  
  731.     struct BitMap    *Knob[2];    // BitMaps of the knob
  732.  
  733.     WORD         KnobWidth;    // Width of knob (actually half of it)
  734.     WORD         KnobTop;    // Distance from knob to level body
  735.     WORD         LevelHeight;    // Height of level body
  736. } LevelImageInfo;
  737.  
  738.     // Level class control tags
  739.  
  740. #define LVIA_Current    (TAG_USER+0xF000)    // Current value
  741. #define LVIA_Max    (TAG_USER+0xF001)    // Maximum value
  742. #define LVIA_DrawInfo    (TAG_USER+0xF002)    // Pens, etc.
  743. #define LVIA_Position    (TAG_USER+0xF003)    // Position of knob
  744. #define LVIA_KnobWidth    (TAG_USER+0xF004)    // Width of knob
  745. #define LVIA_FontWidth    (TAG_USER+0xF005)    // Reference font width
  746. #define LVIA_Screen    (TAG_USER+0xF006)    // Screen to draw this image on
  747.  
  748.  
  749. /*****************************************************************************/
  750.  
  751.  
  752. enum
  753. {
  754.     STORAGE_BYTE,STORAGE_UBYTE,
  755.     STORAGE_WORD,STORAGE_UWORD,
  756.     STORAGE_LONG,STORAGE_ULONG,
  757.     STORAGE_STRPTR
  758. };
  759.  
  760.  
  761. /*****************************************************************************/
  762.  
  763.  
  764.     // A single colour in 96 bit precision
  765.  
  766. struct ColourTriplet
  767. {
  768.     ULONG            Red;        // 32 bits each
  769.     ULONG            Green;
  770.     ULONG            Blue;
  771. };
  772.  
  773.     // A colour table ready to submit to LoadRGB32
  774.  
  775. struct ColourRecord
  776. {
  777.     UWORD            NumColours;    // Number of colours in this chunk
  778.     UWORD            FirstColour;    // First colour entry to set
  779.  
  780.     struct ColourTriplet    Triplets[0];    // Table entries
  781.  
  782.     WORD            Arnold;     // Array terminator, needs to be set to zero
  783. };
  784.  
  785.     // Screen reproduction
  786.  
  787. struct CloneExtra
  788. {
  789.     struct Screen        *Screen;
  790.     LONG            *Pens;
  791.     UWORD            *ScreenPens;
  792.     UWORD             MinWidth,
  793.                  MinHeight,
  794.                  MaxWidth,
  795.                  MaxHeight,
  796.                  TotalPens;
  797.     UBYTE             Depth;
  798.     struct IBox         Bounds;
  799. };
  800.  
  801.  
  802. /*****************************************************************************/
  803.  
  804.  
  805. #define ITEMF_HasSub    (1 << 0)        // Next item is a subitem
  806. #define ITEMF_FirstSub    (1 << 1)        // This is the first subitem
  807. #define ITEMF_IsSub    (1 << 2)        // This is a subitem
  808. #define ITEMF_LastItem    (1 << 3)        // This is the last item
  809. #define ITEMF_IsBar    (1 << 4)        // This is a separator bar
  810. #define ITEMF_Command    (1 << 5)        // This item has a long command key sequence
  811.  
  812. typedef struct ItemNode
  813. {
  814.     struct MinNode     Node;
  815.     struct MenuItem     Item;
  816.     APTR         UserData;
  817.     ULONG         ID;            // Item ID
  818.  
  819.     STRPTR         ExtraLabel;        // For long command sequence labels
  820.     UWORD         Flags;            // Flag bits as defined above
  821.     WORD         Left,            // Actual left edge
  822.              Top;            // Actual top edge
  823.     WORD         Width;            // Actual width
  824.  
  825.     UWORD         MenuCode;        // Intuition menu code
  826.  
  827.     ULONG         Qualifier;        // Message qualifier
  828.     UWORD         Code;            // Message code
  829.     UBYTE         Char;            // ASCII code
  830. } ItemNode, *pItemNode;
  831.  
  832. typedef struct MenuNode
  833. {
  834.     struct MinNode     Node;
  835.     struct Menu     Menu;
  836.     APTR         UserData;
  837.     ULONG         ID;            // Item ID
  838.  
  839.     WORD         Width;            // Actual width
  840.  
  841.     UWORD         MenuCode;        // Intuition menu code
  842. } MenuNode, *pMenuNode;
  843.  
  844. typedef struct RootMenu
  845. {
  846.     APTR             Pool;        // Memory allocation
  847.     struct TextFont        *Font;        // Preferred item font
  848.     struct TextAttr        *TextAttr;    // What goes into the single items
  849.     struct TTextAttr     BoldAttr;    // Same as above, just in boldface
  850.     struct DrawInfo        *DrawInfo;    // Screen drawing info
  851.     struct Screen        *Screen;    // The screen we are building the menu for
  852.     struct RastPort         RPort;        // Dummy RastPort for font measuring
  853.  
  854.     WORD             ItemHeight;    // Default item height
  855.     UWORD             TextPen;    // Text rendering pen
  856.  
  857.     ULONG             CheckWidth,    // Size of the checkmark glyph
  858.                  CheckHeight,
  859.                  AmigaWidth,    // Size of the Amiga glyph
  860.                  AmigaHeight;
  861.  
  862.     struct MinList         MenuList;    // List of menus
  863.     struct MinList         ItemList;    // List of menu items
  864.  
  865.     LayoutHandle        *Handle;    // Layout handle if any
  866.     struct Hook        *LocaleHook;    // Localization, if no handle is provided
  867.  
  868.     struct MinNode         Node;        // The initial menu all the data is tied to
  869.     struct Menu         Menu;
  870.     APTR             UserData;
  871.     ULONG             ID;
  872.     WORD             Width;
  873.     UWORD             MenuCode;
  874. } RootMenu, *pRootMenu;
  875.  
  876.  
  877. /*****************************************************************************/
  878.  
  879.  
  880. typedef struct PopInfo
  881. {
  882.     struct CheckGlyph *CheckGlyph;
  883.  
  884.     LONG         MaxLen;
  885.     LONG         MaxWidth;
  886.  
  887.     struct Window    *Window;
  888.     struct TextFont    *Font;
  889.  
  890.     LONG         TopMost;
  891.  
  892.     LONG         LastDrawn;
  893.     LONG         LastLabelDrawn;
  894.  
  895.     STRPTR        *Labels;
  896.     LONG         NumLabels;
  897.     LONG         Active;
  898.     LONG         InitialActive;
  899.     UWORD         ActiveLen;
  900.  
  901.     UWORD         MarkLeft;
  902.     UWORD         MarkWidth;
  903.  
  904.     UWORD         LabelLeft;
  905.     UWORD         LabelTop;
  906.  
  907.     UWORD         LineTop;
  908.  
  909.     UWORD         ArrowTop;
  910.     UWORD         ArrowWidth;
  911.     UWORD         ArrowHeight;
  912.  
  913.     UWORD         PopLeft;
  914.     UWORD         PopWidth;
  915.  
  916.     UWORD         BoxLeft,BoxTop,
  917.              BoxWidth,BoxHeight;
  918.  
  919.     UWORD         BoxLines;
  920.  
  921.     UWORD         SingleWidth,
  922.              SingleHeight;
  923.  
  924.     UWORD         MenuText,MenuBack;
  925.     UWORD         MenuTextSelect,MenuBackSelect;
  926.  
  927.     UBYTE         Flags;
  928.     BOOLEAN         Blocked;
  929.     BOOLEAN         CentreActive;
  930. } PopInfo;
  931.  
  932. #define PIA_Labels        (TAG_USER+0x80000)
  933. #define PIA_Active        (TAG_USER+0x80001)
  934. #define PIA_Font        (TAG_USER+0x80002)
  935. #define PIA_Highlight        (TAG_USER+0x80003)
  936. #define PIA_CentreActive    (TAG_USER+0x80004)
  937.  
  938.  
  939. /*****************************************************************************/
  940.  
  941.  
  942. typedef struct TabEntry
  943. {
  944.     struct BitMap    *BitMap;
  945.     UWORD         Left;
  946. } TabEntry;
  947.  
  948. typedef struct TabInfo
  949. {
  950.     struct BitMap    *BitMap;
  951.     struct RastPort     RPort;
  952.     PLANEPTR     Mask;
  953.     BOOL         ChipMask;
  954.  
  955.     TabEntry    *Tabs;
  956.     WORD         Count;
  957.     WORD         Current;
  958.     WORD         Initial;
  959.  
  960.     UWORD         Thick;
  961.     UWORD         TabWidth;
  962.     UWORD         TabHeight;
  963.  
  964.     WORD         Offset;
  965. } TabInfo;
  966.  
  967. #define TIA_Labels    (TAG_USER+0x90000)
  968. #define TIA_Font    (TAG_USER+0x90001)
  969. #define TIA_Screen    (TAG_USER+0x90002)
  970. #define TIA_Index    (TAG_USER+0x90003)
  971. #define TIA_DrawInfo    (TAG_USER+0x90004)
  972. #define TIA_SizeType    (TAG_USER+0x90005)
  973.  
  974.  
  975. /*****************************************************************************/
  976.  
  977.  
  978. struct CheckGlyph
  979. {
  980.     UWORD         Width,
  981.              Height;
  982.     struct BitMap    *Plain;
  983.     struct BitMap    *Selected;
  984. };
  985.  
  986.  
  987. /*****************************************************************************/
  988.  
  989. /* These may not be defined in the default header files. */
  990.  
  991. #ifndef GDOMAIN_MINIMUM
  992. #define    GDOMAIN_MINIMUM (0)    /* Minimum size */
  993. #endif    /* GDOMAIN_MINIMUM */
  994.  
  995. #ifndef GDOMAIN_NOMINAL
  996. #define    GDOMAIN_NOMINAL    (1)    /* Nominal size */
  997. #endif    /* GDOMAIN_NOMINAL */
  998.  
  999. #ifndef GDOMAIN_MAXIMUM
  1000. #define    GDOMAIN_MAXIMUM    (2)    /* Maximum size */
  1001. #endif    /* GDOMAIN_MAXIMUM */
  1002.  
  1003.  
  1004. /*****************************************************************************/
  1005.  
  1006.  
  1007. #endif
  1008.